package gmusic.bo;

import java.io.File;
import java.sql.ResultSet;
import java.sql.SQLException;

public class OptionBean {

	public static final String TABLE_NAME = "options";

	private String id;
	public static final String idColumnName = "id";

	private String value;
	public static final String valueColumnName = "value";

	private String type;
	public static final String typeColumnName = "type";

	public OptionBean(ResultSet rs) throws SQLException {
		setId(rs.getString(idColumnName));
		setValue(rs.getString(valueColumnName));
		setType(rs.getString(typeColumnName));
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getId() {
		return id;
	}

	public boolean isBooleanType() {
		if (type != null && type.equalsIgnoreCase("boolean")) {
			return true;
		}
		return false;
	}

	public boolean getBooleanValue() {
		if (value.equalsIgnoreCase("true")) {
			return true;
		} else {
			return false;
		}
	}
	
	public int getIntValue() {
		return Integer.parseInt(value);
	}
	
	public File getFileValue() {
		return new File(value);
	}
}
